﻿using System;
using System.Configuration;
using SMSGateway.Common;

namespace SBK.SMSGateway.Entities.Utils
{
    public class MyConfig
    {
        public string rptAuthenFail;
        public string rptSuccessful;
        public string rptStructureError;
        public string Suport;

        public string rptDataPrice;
        public string PhoneSuport1;
        public string PhoneSuport2;

        public string KeyWord;
        public string ServiceID;
        public string CommandCode;
        public string RequestID;
        public string ContentType;
        public string rvUserName;
        public string rvPassword;


        public string urlWorldGold;
        public string urlVNGold;
        public string urlSJCGold;
        public string urlBTMCGold;
        public string urlSBJGold;
        public int MaximumLengthSMSofGold;

        public MyConfig()
        {
            this.rptAuthenFail = "";
            this.rptSuccessful = "";
            this.rptStructureError = "";
            this.Suport = "";

            this.rptDataPrice = "";
            this.PhoneSuport1 = "";
            this.PhoneSuport2 = "";

            this.KeyWord = "";
            this.ServiceID = "";
            this.CommandCode = "";
            this.RequestID = "";
            this.ContentType = "";
            this.rvUserName = "";
            this.rvPassword = "";

            this.urlWorldGold = "";
            this.urlVNGold = "";
            this.urlSJCGold = "";
            this.urlBTMCGold = "";
            this.urlSBJGold = "";
            this.MaximumLengthSMSofGold = 0;
        }

        public bool GetMyConfig()
        {
            try
            {
                this.rptAuthenFail = ConfigurationManager.AppSettings["rptAuthenFail"].ToString();
                this.rptSuccessful = ConfigurationManager.AppSettings["rptSuccessful"].ToString();
                this.rptStructureError = ConfigurationManager.AppSettings["rptStructureError"].ToString();
                this.Suport = ConfigurationManager.AppSettings["Suport"].ToString();

                this.rptDataPrice = ConfigurationManager.AppSettings["rptDataPrice"].ToString();
                this.PhoneSuport1 = ConfigurationManager.AppSettings["PhoneSuport1"].ToString();
                this.PhoneSuport2 = ConfigurationManager.AppSettings["PhoneSuport2"].ToString();

                this.KeyWord = ConfigurationManager.AppSettings["KeyWord"].ToString();
                this.ServiceID = ConfigurationManager.AppSettings["ServiceID"].ToString();
                this.CommandCode = ConfigurationManager.AppSettings["CommandCode"].ToString();
                this.RequestID = ConfigurationManager.AppSettings["RequestID"].ToString();
                this.ContentType = ConfigurationManager.AppSettings["ContentType"].ToString();
                this.rvUserName = ConfigurationManager.AppSettings["rvUserName"].ToString();
                this.rvPassword = ConfigurationManager.AppSettings["rvPassword"].ToString();

                this.urlWorldGold = ConfigurationManager.AppSettings["urlWorldGold"].ToString();
                this.urlVNGold = ConfigurationManager.AppSettings["urlVNGold"].ToString();
                this.urlSJCGold = ConfigurationManager.AppSettings["urlSJCGold"].ToString();
                this.urlBTMCGold = ConfigurationManager.AppSettings["urlBTMCGold"].ToString();
                this.urlSBJGold = ConfigurationManager.AppSettings["urlSBJGold"].ToString();
                this.MaximumLengthSMSofGold = Int32.Parse(ConfigurationManager.AppSettings["MaximumLengthSMSofGold"].ToString());
                return true;
            }
            catch (Exception ex)
            {
                Logger.Error("GetMyConfig Error ! ", ex);
                throw;
            }
        }
    }
}
